﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using Parallel3M.parallel3m.framework;
using System.Xml;

namespace Parallel3M.parallel3m.protocol
{
    public class ProtocolHandler
    {
        public ProtocolProtype protocol;

        public Hashtable getParameters(String contentXml)
        {
            
            Hashtable parameters = new Hashtable();
            // Create an XmlReader
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(contentXml);
            XmlNode requestNode = doc.ChildNodes[0];
            XmlAttributeCollection atts = requestNode.Attributes;
            foreach (XmlAttribute att in atts)
            {
                parameters.Add(att.Name, att.Value);
            }
            XmlNodeList nodes = doc.ChildNodes[0].ChildNodes;
            foreach (XmlNode node in nodes)
            {
                parameters[node.Name] = node.InnerXml;
            }

            return parameters;
        }

        public virtual ArrayList handler(ParallelPayload payload)
        {
            return null;
        }
    }
}
